import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home/Home.vue';
// 屏蔽路由重复报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};
Vue.use(VueRouter);

const routes = [
    {
        path: '/login',
        name: 'Login',
        component: () => import(/* webpackChunkName: "about" */ '../views/Login/Login.vue')
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [
            {
                path: '/orderManage',
                name: 'OrderManage',
                component: () => import('../views/Home/components/OrderManage/OrderManage.vue'),
                meta: {
                    title: '工单管理'
                }
            },
            {
                path: '/projectBudgetDetail',
                name: 'ProjectBudgetDetail',
                component: () => import('../views/Home/components/ProjectBudgetDetail/ProjectBudgetDetail.vue'),
                meta: {
                    title: '工单预算清单'
                }
            },
            {
                path: '/constrctionTask',
                name: 'ConstrctionTask',
                component: () => import('../views/Home/components/ConstrctionTask/ConstrctionTask.vue'),
                meta: {
                    title: '施工任务'
                }
            },
            {
                path: '/checkApplication',
                name: 'CheckApplication',
                component: () => import('../views/Home/components/CheckApplication/CheckApplication.vue'),
                meta: {
                    title: '验收申请'
                }
            },
            {
                path: '/changeScret',
                name: 'ChangeScret',
                component: () => import('../views/Home/components/User/ChangeScret/ChangeScret.vue'),
                meta: {
                    title: '修改密码'
                }
            },
            {
                path: '/childAccountMange',
                name: 'ChildAccountMange',
                component: () => import('../views/Home/components/User/ChildAccountMange/ChildAccountMange.vue'),
                meta: {
                    title: '子账户管理'
                }
            }
        ]
    }
];
routes.push({
    path: '/',
    redirect: '/login'
});
const router = new VueRouter({
    routes
});

export default router;
